package com.gnerv.battle.boot.module.base.controller;

import com.gnerv.battle.boot.common.base.model.RestResult;
import com.gnerv.battle.boot.module.base.business.AuditApiBusiness;
import com.gnerv.battle.boot.module.base.model.dto.AuditApiDTO;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Gnerv LiGen
 */
@RestController
@AllArgsConstructor
@RequestMapping(value = "api/manage/audit")
public class AuditApiController {

    private final AuditApiBusiness auditApiBusiness;

    @GetMapping(value = "")
    public RestResult<AuditApiDTO> selectByUkId(@RequestParam(value = "ukId") String ukId) {
        return auditApiBusiness.selectByUkId(ukId);
    }

    @GetMapping(value = "list")
    public RestResult<List<AuditApiDTO>> listByName(@RequestParam(required = false, value = "name") String name,
                                                    @RequestParam(required = false, value = "page") Integer page,
                                                    @RequestParam(required = false, value = "size") Integer size) {
        return auditApiBusiness.listByName(name, page, size);
    }

}
